﻿@model S4Store.Models.AfterSaleCarKPI.ServiceAdvisorIndexModel
@{
    ViewBag.Title = "AfterSaleCarKPI";
    Layout = null;
}
<style type="text/css">
.reporttable2 td,.reporttable2 th
{
    padding:5px;
    border:1px  solid #B8D0D6;
    vertical-align:middle;
    color:#183152;
}
.reporttable2 th
{
    text-align:center;
    background:#E5EDEF
}
.reporttable2 .day
{
    width:25px;
    height:25px;
    text-align:center;
    vertical-align:middle;
}
.reporttable2 .month
{
    width:80px;
    height:25px;
    text-align:center;
    vertical-align:middle;
}

</style>
<div class="verticalSplitContainer" style="height:100%;width:100%; overflow:hidden">
@Html.Action("StoreList", "Common", new { action = "Index", controller = "AfterSaleServiceAdvisor" })
<div style="width:100%; overflow:auto" ratio="*">
<table   style="border-collapse:collapse; margin:20px" class="reporttable2">
    <tr>
        <th>年</th>
        <th colspan="2">月初计划</th>
        <th colspan="31">
        <div style="float:left">每日数据</div>
        <div style="float:right">
            <div class="indexred">红色为未录入</div>
          <div class="indexyellow">黄色为未确认</div>
            <div class="indexgreen">绿色为已确认</div>
        </div>
        </th>
    </tr>
    @for (int y = 0; y < 2; y++)
    {
        int mtotal = 12;
        if (y == 0)
        {
            mtotal = DateTime.Now.Month;
        }
        for (int m = mtotal; m > 0; m--)
        {
            DateTime dt = DateTimeExtend.MonthLastOrNow(DateTime.Now.AddYears(y * -1).Year, m, DateTime.Now.Day);
            //DateTime dt = new DateTime(DateTime.Now.AddYears(y * -1).Year, m, DateTime.Now.Day).MonthLastOrNow();
    <tr>
        @if (m == mtotal)
        {
        <td rowspan="@mtotal" >@DateTime.Now.AddYears(y * -1).Year</td>
        }
        @Html.Action("MonthTarget", new { y = DateTime.Now.AddYears(y * -1).Year, m = m })
        @for (int d = 1; d <= 31; d++)
        {
            if(d>dt.Day){
                <td></td>
            }else{
                var status=Model.GetDayStatus(DateTime.Now.AddYears(y * -1).Year,m,d);
            
                if (status == null)
                {
            <td   class="day bgred"><a href="@Url.Action("DayInput", new { y = DateTime.Now.AddYears(y * -1).Year, m = m, d = d })" target="dialog" width="1100" backtype="html" refreshonclose="true" title="录入@(m)月@(d)日数据">@d</a></td>
                }
                else if (status == S4Store.Domain.DataConfirmStatus.Confirmed)
                {
            <td class="day bggreen"><a href="@Url.Action("DayInput", new { y = DateTime.Now.AddYears(y * -1).Year, m = m, d = d })" target="dialog"  width="1100"  backtype="html" refreshonclose="true" title="查看@(m)月@(d)日数据">@d</a></td>
                }
                else
                {
                <td   class="day bgyellow"><a href="@Url.Action("DayInput", new { y = DateTime.Now.AddYears(y * -1).Year, m = m, d = d })" target="dialog"  width="1100"  backtype="html" refreshonclose="true" title="录入@(m)月@(d)日数据">@d</a></td>
                    
                }
            }
        }
    </tr>   
        }
    }
</table>
</div>
</div>
